const chalk = require("chalk");
const execCmd = require("./utils/execCmd");

(async () => {
  try {
    // 获取进程中的命令行参数
    const { argv = [] } = process;
    const [, , mode, gameName] = argv;
    
    // 如果没有输入文件夹名称
    if (!gameName) {
      throw new Error("请输入项目文件夹名称");
    }

    // 执行命令
    execCmd(mode, gameName);
  } catch (error) {
    console.log(chalk.red.bold(`====== ${error} ======`));
  }
})();
